#include <iostream>

#include "comm.hpp"
#include "log.hpp"

using namespace std;

int main()
{
    Log log;
    // 打开文件
    int wfd = open(FIFO_FILE, O_WRONLY);
    if (wfd < 0)
    {
        log(Fatal, "%s %d", strerror(errno), errno);
        exit(FILE_OPEN_ERR);
    }
    cout << "client open file done" << endl;

    std::string str;
    while (true)
    {
        cout << "请传输信息@: ";
        getline(cin, str);
        write(wfd, str.c_str(), str.size());
    }
    close(wfd);
    // 关闭文件

    return 0;
}